<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        #aneBox{
            width: 307px;
            height: 400px;
        }
        .but{
            display: flex;
        }
        p{
            text-align: center;
            width:100px;
            height: 30px;
            margin: none;
            line-height: 30px;
            border: 1px solid #000;
        }
        .content{
            width: 100%;
            height: 370px;
            text-align: center;
            line-height: 370px;
            background-color: yellow;
        }
        .yellow{
            background-color: yellow;
        }
    </style>
  </head>
  <body>
    <div id="aneBox">
      <Ane></Ane>
    </div>
    <!-- 第一个 -->
    <!-- 父组件 -->
    <template id="box1">
        <div >
            <div class="but">
                <div  v-for="item in arr" >
                    <p :class="{yellow:color==false}" @click="language(item.name,item.newClass)">{{item.name}}</p>
                  
                  </div>
            </div>
              <qq :vv="newArr" ></qq>
        </div>
        
    </template>
   <!-- 子组件 -->
   <template id="box2">
        <div>
            <div class="content"><h1>{{vv}}</h1></div>
        </div>
    </template>

  


    <!-- <template id="box3">
        <div>
            
        </div>
    </template>  -->
    <script>
      Vue.config.productionTip = false;
      const two={
        template:"#box2",
        props:["vv"]
      }  
      const ane = {
        template: "#box1",
        data() {
          return {
            color:false,
            newArr:"",
            arr: [
            {name: "语文" ,newClass:true},
            {name: "数学" ,newClass:true},
            {name: "英语" ,newClass:true}
              
            ],
          };
        },
        methods: {
            language(i,v){
               
               this.color=v
                this.newArr=i;
                console.log(i);
               
            }
        },
        components:{
            "qq":two,
        }
      };
      new Vue({
        el: "#aneBox",
        components: {
          Ane: ane,
        },
      });
      // ["地理","历史","政治"],
      // ["生物","化学","物理","社会","雅思"]
    </script>
  </body>
</html>
